package Test;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class AutomaticRollCallDeviceTest2 {
    public static void main(String[] args) {
        //先创建集合：
        ArrayList<String> list1 = new ArrayList<>();
        ArrayList<String> list2 = new ArrayList<>();
        Collections.addAll(list1,"张三","李四","王五","赵六","孙七","周八","吴九","郑十");

        int count = list1.size();

        //被点到的学生：
        Random r = new Random();

        //所有的学生都被点完了：

        for (int i = 1; i <= count ; i++) {
            System.out.println("__________第" + i + "轮点名开始了___________");

            for (int j= 0; j < count; j++) {
                int Index = r.nextInt(list1.size());
                String name  = list1.remove(Index);
                list2.add(name);
                System.out.println(name);
            }
            //此时表示第一轮点名结束：
            //list1 空了 ，list2 10个学生的名字：
            list1.addAll(list2);
            list2.clear();

        }









    }
}
